<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('挂号信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>索引：</label>
                                <input type="text" name="suoying"/>
                            </li>
                            <li>
                                <label>预约单号：</label>
                                <input type="text" name="yuyueNum"/>
                            </li>
                            <li>
                                <label>医生工号：</label>
                                <input type="text" name="doctorNum"/>
                            </li>
                            <li>
                                <label>医生姓名：</label>
                                <input type="text" name="doctorName"/>
                            </li>
                            <li>
                                <label>医生职称：</label>
                                <select name="doctorZhicheg" th:with="type=${@dict.getType('sys_yszc')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>科室名称：</label>
                                <select name="keshiName" th:with="type=${@dict.getType('sys_keshi')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>挂号金额：</label>
                                <input type="text" name="guahaoDoller"/>
                            </li>
                            <li>
                                <label>挂号时间：</label>
                                <input type="text" class="time-input" placeholder="请选择挂号时间" name="guahaoTime"/>
                            </li>
                            <li>
                                <label>就诊状态：</label>
                                <select name="jiuzhengnStatus" th:with="type=${@dict.getType('sys_jzzt')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>用户名：</label>
                                <input type="text" name="userName"/>
                            </li>
                            <li>
                                <label>姓名：</label>
                                <input type="text" name="name"/>
                            </li>
                            <li>
                                <label>手机：</label>
                                <input type="text" name="phone"/>
                            </li>
                            <li>
                                <label>身份证：</label>
                                <input type="text" name="cardNum"/>
                            </li>
                            <li>
                                <label>是否支付：</label>
                                <select name="payFlag" th:with="type=${@dict.getType('sys_zhifu_flag')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
<!--                            <li>-->
<!--                                <label>审核回复：</label>-->
<!--                                <input type="text" name="shengheHuifu"/>-->
<!--                            </li>-->
                            <li>
                                <label>审核状态：</label>
                                <select name="shengheStatus" th:with="type=${@dict.getType('sys_shzt')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasRole="patient">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasRole="patient">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasRole="patient">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasAnyRoles="patient,manager">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasRole('manager')}]];
        var removeFlag = [[${@permission.hasRole('manager')}]];
        var doctorZhichegDatas = [[${@dict.getType('sys_yszc')}]];
        var keshiNameDatas = [[${@dict.getType('sys_keshi')}]];
        var jiuzhengnStatusDatas = [[${@dict.getType('sys_jzzt')}]];
        var payFlagDatas = [[${@dict.getType('sys_zhifu_flag')}]];
        var shengheStatusDatas = [[${@dict.getType('sys_shzt')}]];
        var prefix = ctx + "system/register";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "挂号信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '',
                    visible: false
                },
                {
                    field: 'suoying',
                    title: '索引'
                },
                {
                    field: 'yuyueNum',
                    title: '预约单号'
                },
                {
                    field: 'doctorNum',
                    title: '医生工号'
                },
                {
                    field: 'doctorName',
                    title: '医生姓名'
                },
                {
                    field: 'doctorZhicheg',
                    title: '医生职称',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(doctorZhichegDatas, value);
                    }
                },
                {
                    field: 'keshiName',
                    title: '科室名称',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(keshiNameDatas, value);
                    }
                },
                {
                    field: 'guahaoTime',
                    title: '挂号时间'
                },
                {
                    field: 'jiuzhengnStatus',
                    title: '就诊状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(jiuzhengnStatusDatas, value);
                    }
                },
                {
                    field: 'userName',
                    title: '用户名'
                },
                {
                    field: 'name',
                    title: '姓名'
                },
                {
                    field: 'phone',
                    title: '手机'
                },
                {
                    field: 'cardNum',
                    title: '身份证'
                },
                {
                    field: 'payFlag',
                    title: '是否支付',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(payFlagDatas, value);
                    }
                },
                {
                    field: 'shengheHuifu',
                    title: '审核回复'
                },
                {
                    field: 'shengheStatus',
                    title: '审核状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(shengheStatusDatas, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if (row.shengheStatus != 2){
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>审核</a> ');
                        }
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>